﻿@{
    var styles = string.Empty;

    if (Model.Width > 0)
    {
        styles += $"width:{Model.Width}px;";
    }
    else
    {
        styles += "width:100%;";
    }

    if (Model.Height > 0)
    {
        styles += $"height:{Model.Height}px;";
    }
    else
    {
        styles += "height:100px;";
    }
}

<div id="@ContainerId" class="easyxaf-image-viewer" style="@styles"></div>

@code {
    public static RenderFragment Create(ImageViewerModel model)
    {
        return @<ImageViewerRenderer Model="model" />;
    }
}